<%-- 
    Document   : profillecture
    Created on : 18-May-2012, 6:07:00 PM
    Author     : James
--%>

<%@page import="application.VillePaysBean"%>
<%@page import="application.MembreBean"%>
<%@page import="application.Facade"%>
<%@page import="controleur.ConstantesWeb"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Profil</title>
        <link rel="stylesheet" type="text/css" href="<%=ConstantesWeb.CSS_ENTETE%>"/>
    </head>
    <body bgcolor="66CC99">
        <%
            Facade f = new Facade();
            MembreBean membre;

            membre = f.getMembre(request.getCookies());

            if (membre == null) {
                out.print("<h1 align=\"center\">Erreur</h1>");
                return;
            } else if (!f.getTypeValeur(membre.getIdCompte()).equalsIgnoreCase(ConstantesWeb.COMPTE_ADMIN)) {
                out.print("<h1 align=\"center\">Accès invalide</h1>");
                return;
            }

            MembreBean m = (MembreBean) request.getAttribute(ConstantesWeb.VALEUR_MEMBRE);
            VillePaysBean vp = (VillePaysBean) request.getAttribute(ConstantesWeb.VALEUR_VILLE_PAYS);
        %>
        <jsp:include page="<%=ConstantesWeb.PAGE_ENTETE%>"/>
        <h1 align="left">Profil de <%=m.getNomUtilisateur()%></h1>

        <table width="700" border="0">
            <tr>
                <td align="left">Nom d'utilisateur :</td>
                <td align="left">
                    <input type="text" name="username" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=m.getNomUtilisateur()%>">
                </td>
                <td width="250" rowspan="8" align="center">
                    <FORM name="<%=ConstantesWeb.CMD_IMAGE%>" METHOD="POST" ACTION="./Entree">
                        <input type="hidden" name="idImage" value="<%=m.getIdImage()%>"/>
                        <input type="hidden" name="cmd" value="<%=ConstantesWeb.CMD_IMAGE%>"/>

                        <a href="#" onclick="document.forms['<%=ConstantesWeb.CMD_IMAGE%>'].submit();">
                            <img src="./<%=ConstantesWeb.PAGE_IMAGE%>?<%=ConstantesWeb.VALEUR_IMAGE_ID%>=<%=m.getIdImage()%>" height="150" width="150" align="center"/>
                        </a>
                    </FORM> 
                </td>
            </tr>            
            <tr>
                <td align="left">Type de compte :</td>
                <td align="left">
                    <input type="text" name="compte" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=f.getTypeValeur(m.getIdCompte())%>">
                </td>
            </tr>
            <tr>                
                <td align="left"><br>Prénom :</td>
                <td align="left">
                    <br><input type="text" name="prenom" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                               disabled="disabled" value="<%=m.getPrenom()%>">
                </td>
            </tr>
            <tr>
                <td align="left">Nom :</td>
                <td align="left">
                    <input type="text" name="nom" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=m.getNomFamille()%>">
                </td>
            </tr>
            <tr>
                <td align="left">Courriel :</td>
                <td align="left">
                    <input type="text" name="courriel" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=m.getCourriel()%>">
                </td>
            </tr>
            <tr>
                <td align="left">Adresse :</td>
                <td align="left">
                    <input type="text" name="adresse" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=m.getAdresse()%>">
                </td>
            </tr>
            <tr>
                <td align="left">Téléphone :</td>
                <td align="left">
                    <input type="text" name="telephone" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" 
                           disabled="disabled" value="<%=m.getTelephone()%>">
                </td>
            </tr>
            <tr>
                <td align="left">Ville :</td>
                <td align="left">
                    <input type="text" name="telephone" size="<%=ConstantesWeb.BD_STRING_LENGTH%>" disabled="disabled" 
                           value="<%=vp.getVille() + ", " + f.getTypeValeur(vp.getIdPays())%>">
                </td>
            </tr>
        </table>

        <br/>
        <h2>Options</h2>
        <table>
            <tr>
                <td>
                    <FORM METHOD="POST" ACTION="./Entree">
                        <input type="hidden" name="cmd" value="<%=ConstantesWeb.CMD_AFFICHER_MEMBRES%>"/>
                        <button style="width: 150px">Tous les membres</button>
                    </FORM>
                </td>
                <td>
                    <FORM METHOD="POST" ACTION="./Entree">
                        <input type="hidden" name="cmd" value="<%=ConstantesWeb.CMD_AFFICHER_COMPTES%>"/>
                        <button style="width: 150px">Tous les comptes</button>
                    </FORM>
                </td>
            </tr>
        </table>
    </body>
</html>
